﻿///////////////////////////////////////////////////////////////
//                                                           //
// Code from Arcanea Project.                                //
//                                                           //
// Please include this license part to every reproduction    //
//   of code.                                                //
//                                                           //
// This code is under Ms-RL license                          //
//                                                           //
// Please read futher information about the license,         //
//   the project (news and updates) and the                  //
//   contributors on the address :                           //
//     http://www.codeplex.com/Arcanea/                      //
//                                                           //
///////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;

namespace Arcanea.NetworkEngine.Abstract.Engines
{
    /// <summary>
    /// Conteneur permettant d'identifier un point sur le réseau selon un protocole
    /// </summary>
    public class NetInformationContainer
    {
        private string server;
        /// <summary>
        /// String qui identifie le serveur. par exemple "google.fr"
        /// </summary>
        public string Server { get { return server; } set { server = value; } }

        private int portPrincipal;
        /// <summary>
        /// Port principal de la connection : par exemple 80
        /// </summary>
        public int PortPrincipal { get { return portPrincipal; } set { portPrincipal = value; } }

        private int portSecondaire;
        /// <summary>
        /// Port secondaire pour la connection. Exemple d'une double connection UDP
        /// </summary>
        public int PortSecondaire { get { return portSecondaire; } set { portSecondaire = value; } }

        private Socket socket;
        /// <summary>
        /// Socket de communication, une fois construit
        /// </summary>
        public Socket Socket { get { return socket; } set { socket = value; } }

        private EndPoint lastEndPointUsed;
        /// <summary>
        /// EndPoint définissant 
        /// </summary>
        public EndPoint LastEndPointUsed { get { return lastEndPointUsed; } set { lastEndPointUsed = value; } }

        /// <summary>
        /// Clone l'objet courant.
        /// </summary>
        /// <returns>L'objet cloné</returns>
        public NetInformationContainer Clone()
        {
            NetInformationContainer container = new NetInformationContainer();
            container.Server = this.Server;
            container.PortPrincipal = this.PortPrincipal;
            container.PortSecondaire = this.PortSecondaire;
            container.Socket = this.Socket;
            container.LastEndPointUsed = this.LastEndPointUsed;

            return container;
        }
    }
}
